As it is known, a method for writing data in a non volatile memory unit provides an erase operation for erasing data previously stored in the memory unit and a program operation for storing the data in the memory unit.
More particularly, the memory unit comprises memory pages including a predetermined number of memory cells, the memory cells storing memory words.
The memory word comprises a predetermined sequence of digital values also indicated as value and complementary value, for example, the sequence 01110010. For clarity, in the following description, the complementary value is associated to the number 0 and the value is associated to the number 1.
More particularly, the erase operation is to erase the memory words stored in the memory cells of a predetermined memory page, setting the predetermined sequence of digital values to a sequence of complementary values 0, while the program operation is to store in the memory cell a word to be stored, setting a sequence of digital values of such words in the memory cell.
More particularly, the erase operation is executed before a program operation for setting the values of 1 in the predetermined sequence to the complementary value 0, since the program operation may not change a value 1 into a complementary value 0.
For example, the program operation may not store a word 00010101 in a memory cell that stores the memory word 01010101, since the second value 1 of the memory word 01010101 may not be overwritten by the second complementary value 0 of the word 00010101 without an erase operation.
So an erase operation is executed before the program operation, to erase the predetermined sequence 01010101 into a sequence of complementary values 00000000, after that the program operation is executed.
Physical constraints of the memory unit, however, may limit the number of erase and program operations that can be executed for writing data.
This method may significantly stress the memory unit since each writing involves at least one erase operation and one program operation. Moreover, the number of erase operations and program operations increases significantly when power interruption protection for data is used, for example power off protection.
Power off protection is helpful to preserve data stored in the memory unit during the execution of the writings. More particularly, data stored in the memory unit before the execution of the writing are preserved in a specific portion of the memory unit, also indicated as a backup buffer.
If an unexpected power off occurs during the execution of the method, the data stored in the backup buffer is restored in the memory unit, so that an inconsistent value of data in the memory unit may be prevented.
Even if advantageous, because safe, power off protection increases the number of executions of the method for writing since an additional erase operation and an additional program operation are involved respectively to erase the backup buffer for erasing data previously stored, and to program it for storing the data of the memory unit intended to be updated.
Moreover, if a power off occurs during the execution of the method, the number of writing operations further increases.
In fact, since the memory unit may be restored with the values of the backup buffer, another erasing operation and another program operation are involved, respectively to erase the memory unit, for erasing data in an inconsistent state, and to program it, restoring data from the backup buffer.